﻿using FBroSharp;
using FBroSharp.DataType;
using FBroSharp.Lib;
using FBroSharp.Value;
using FBroSharp.VIP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace wss测试
{
    public class BrowserDis
    {

        public static string[] fontList = { "Arial", "Arial Black", "Bahnschrift", "Calibri", "Cambria", "Cambria Math", "Candara", "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier New", "Ebrima", "Franklin Gothic Medium", "Gabriola", "Gadugi", "Georgia", "HoloLens MDL2 Assets", "Impact", "Ink Free", "Javanese Text", "Leelawadee UI", "Lucida Console", "Lucida Sans Unicode", "Malgun Gothic", "Marlett", "Microsoft Himalaya", "Microsoft JhengHei", "Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Sans Serif", "Microsoft Tai Le", "Microsoft YaHei", "Microsoft Yi Baiti", "MingLiU-ExtB", "Mongolian Baiti", "MS Gothic", "MV Boli", "Myanmar Text", "Nirmala UI", "Palatino Linotype", "Segoe MDL2 Assets", "Segoe Print", "Segoe Script", "Segoe UI", "Segoe UI Historic", "Segoe UI Emoji", "Segoe UI Symbol", "SimSun", "Sitka", "Sylfaen", "Symbol", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana", "Webdings", "Wingdings", "Yu Gothic", "Al Bayan", "Al Nile", "Al Tarikh", "American Typewriter", "American Typewriter Condensed", "Andale Mono", "Apple Braille", "Apple Braille Outline 6 Dot", "Apple Braille Outline 8 Dot", "Apple Braille Pinpoint 6 Dot", "Apple Braille Pinpoint 8 Dot", "Apple Chancery", "Apple Color Emoji", "Apple SD Gothic Neo", "Apple SD Gothic Neo Extra", "Apple Symbols", "AppleGothic", "AppleMyungjo", "Arial", "Arial Black", "Arial Hebrew", "Arial Hebrew Scholar", "Arial Narrow", "Arial Rounded MT", "Arial Unicode MS", "Avenir Black", "Avenir Book", "Avenir", "Avenir Next", "Avenir Next Condensed", "Avenir Roman", "Ayuthaya", "Baghdad", "Bangla MN", "Bangla Sangam MN", "Baskerville", "Beirut", "Big Caslon", "Bodoni 72", "Bodoni 72 Book", "Bodoni 72 Oldstyle", "Bodoni 72 Oldstyle Book", "Bodoni 72 Smallcaps Book", "Bodoni Ornaments", "Bradley Hand", "Brush Script MT", "Chalkboard", "Chalkboard SE", "Chalkduster", "Charter Black", "Charter", "Charter Roman", "Cochin", "Copperplate", "Corsiva Hebrew", "Courier", "Courier New", "DIN Alternate", "DIN Condensed", "Damascus", "Damascus Semi", "DecoType Naskh", "Devanagari MT", "Devanagari Sangam MN", "Didot", "Diwan Kufi", "Diwan Thuluth", "Euphemia UCAS", "Farah", "Farisi", "Futura", "Futura Condensed Extra", "Futura Condensed", "GB18030 Bitmap", "Galvji", "Geeza Pro", "Geneva", "Georgia", "Gill Sans", "Gujarati MT", "Gujarati Sangam MN", "Gurmukhi MN", "Gurmukhi MT", "Gurmukhi Sangam MN", "Heiti SC", "Heiti TC", "Helvetica", "Helvetica Neue", "Helvetica Neue Condensed Black", "Helvetica Neue Condensed", "Herculanum", "Hiragino Maru Gothic ProN W4", "Hiragino Mincho ProN W3", "Hiragino Mincho ProN W6", "Hiragino Sans GB W3", "Hiragino Sans GB W6", "Hiragino Sans W0", "Hiragino Sans W1", "Hiragino Sans W2", "Hiragino Sans W3", "Hiragino Sans W4", "Hiragino Sans W5", "Hiragino Sans W6", "Hiragino Sans W7", "Hiragino Sans W8", "Hiragino Sans W9", "Hoefler Text", "Hoefler Text Black", "Hoefler Text Ornaments", "ITF Devanagari", "ITF Devanagari Book", "ITF Devanagari Marathi", "ITF Devanagari Marathi Book", "Impact", "InaiMathi", "Kailasa", "Kannada MN", "Kannada Sangam MN", "Kefa", "Khmer MN", "Khmer Sangam MN", "Kohinoor Bangla", "Kohinoor Devanagari", "Kohinoor Gujarati", "Kohinoor Telugu", "Kokonor", "Krungthep", "KufiStandardGK", "Lao MN", "Lao Sangam MN", "Lucida Grande", "Luminari", "Malayalam MN", "Malayalam Sangam MN", "Marker Felt", "Marker Felt Wide", "Menlo", "Microsoft Sans Serif", "Mishafi Gold", "Mishafi", "Monaco", "Mshtakan", "MuktaMahee", "Muna Black", "Muna", "Myanmar MN", "Myanmar Sangam MN", "Nadeem", "New Peninim MT", "New Peninim MT Bold Inclined", "New Peninim MT Inclined", "Noteworthy", "Noto Nastaliq Urdu", "Noto Sans Javanese", "Noto Sans Kannada Black", "Noto Sans Kannada", "Noto Sans Kannada Extra", "Noto Sans Myanmar Black", "Noto Sans Myanmar", "Noto Sans Myanmar Extra", "Noto Sans Oriya", "Optima", "Oriya MN", "Oriya Sangam MN", "PT Mono", "PT Sans", "PT Sans Caption", "PT Sans Narrow", "PT Serif", "PT Serif Caption", "Palatino", "Papyrus", "Papyrus Condensed", "Phosphate Inline", "Phosphate Solid", "PingFang HK", "PingFang SC", "PingFang TC", "Plantagenet Cherokee", "Raanana", "Rockwell", "STIXGeneral-", "STIXIntegralsD-", "STIXIntegralsSm-", "STIXIntegralsUp-", "STIXIntegralsUpD-", "STIXIntegralsUpSm-", "STIXNonUnicode-", "STIXSizeFiveSym-", "STIXSizeFourSym-", "STIXSizeOneSym-", "STIXSizeThreeSym-", "STIXSizeTwoSym-", "STIXVariants-", "STSong", "Sana", "Sathu", "Savoye LET Plain:1.0", "Shree Devanagari 714", "SignPainter-HouseScript", "Silom", "Sinhala MN", "Sinhala Sangam MN", "Skia Black", "Skia Black Condensed", "Skia Black Extended", "Skia", "Skia Condensed", "Skia Extended", "Skia Light Condensed", "Skia Light Extended", "Snell Roundhand", "Snell Roundhand Black", "Songti SC Black", "Songti SC", "Songti TC", "Sukhumvit Set", "Sukhumvit Set Semi", "Sukhumvit Set Text", "Symbol", "Tahoma", "Tamil MN", "Tamil Sangam MN", "Telugu MN", "Telugu Sangam MN", "Thonburi", "Times", "Times New Roman", "Times Roman", "Trattatello", "Trebuchet MS", "Verdana", "Waseem", "Webdings", "Wingdings", "Wingdings 2", "Wingdings 3", "Zapf Dingbats", "Zapfino", "Droid Sans", "Droid Serif", "Droid Sans Mono", "times new", "goudy" };
        public static string[] mimeTypesList = { "application/futuresplash", "application/msexcel", "application/mspowerpoint", "application/msword", "application/msword-template", "application/pdf", "application/vnd.ces-quickpoint", "application/vnd.ces-quicksheet", "application/vnd.ces-quickword", "application/vnd.ms-excel", "application/vnd.ms-excel.sheet.macroEnabled.12", "application/vnd.ms-excel.sheet.macroenabled.12", "application/vnd.ms-powerpoint", "application/vnd.ms-powerpoint.presentation.macroEnabled.12", "application/vnd.ms-powerpoint.presentation.macroenabled.12", "application/vnd.ms-word", "application/vnd.ms-word.document.12", "application/vnd.ms-word.document.macroEnabled.12", "application/vnd.ms-word.document.macroenabled.12", "application/vnd.msword", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.openxmlformats-officedocument.presentationml.template", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "application/vnd.presentation-openxml", "application/vnd.presentation-openxmlm", "application/vnd.spreadsheet-openxml", "application/vnd.wordprocessing-openxml", "application/x-google-chrome-pdf", "application/x-nacl", "application/x-pnacl", "application/x-shockwave-flash", "text/csv" };

        //创建浏览器
        public static void CreatBrowser(string title, string url, IntPtr parent_window, int x, int y, int width, int height)
        {
            //开始创建浏览器
            FBroSharpWindowsInfo windows_info = new FBroSharpWindowsInfo
            {
                parent_window = parent_window,
                x = x,
                y = y,
                width = width,
                height = height,
                window_name = title
            };

            //创建浏览器事件回调类
            BrowserEvent browser_event = new BrowserEvent();

            //设置运行环境
            //FBroSharpRequestContextSet contextSet = new FBroSharpRequestContextSet();
            //contextSet.cache_path = Directory.GetCurrentDirectory() + "\\Cache\\other cache\\"; ;

            //FBroSharpRequestContext request_context = (FBroSharpRequestContext)FBroSharpRequestContext.CreateContext(contextSet);
            //Console.WriteLine("缓存目录:" + request_context.GetCachePath());

            //设置不需要的事件
            //FBroSharpEventDisableControl event_contrl = new FBroSharpEventDisableControl();
            //event_contrl.disableGetAudioHandler = true;


            //设置传递参数
            //FBroSharpDictionaryValue extra_info = new FBroSharpDictionaryValue();//.Creat();
            //extra_info.SetString("传参测试", "这是创建浏览器的时候传递过来的参数");

            if (FBroSharpControl.CreatBrowser(url, windows_info, default, default /*request_context*/, default/*extra_info*/, browser_event, default/*event_contrl*/))
                Console.WriteLine("true");
        }




    }
}
